9.1 Capability Detection The most commonly used and most widely accepted is that the client detection form is capability detection (also called feature detection). The goal of competency detection is not to identify a particular browser, but to
The code is as follows
Copy Code
function Mybrowser () {var useragent = navigator.useragent; Gets the useragent string for the browservar Isopera = Useragent.indexof ("Opera") >-1; Judge whether Opera browservar Isie =
Solve the hack writing of CSS compatibility in IE6, IE7, IE8, and Firefox
The biggest headache for every CSS adjustment is the browser correction problem, because each browser has different interpretations of CSS. Firefox itself is more
Let's talk about the blog editor first. It's too difficult to use. Once a table is pasted in, it will get stuck. Every time I use the html editor to write it, it's not good! The javascript type detection should be summarized as early as the
In his blog Featuredetectionisnotbrowserdetection of the same name, NCZ describes a popular technology that has been used in front-end development-detection of users' browser platforms, and details historical development and advantages and
Its most classic application is the general addEvent function:
Function addEvent (element, type, handler) {if (element. attachEvent) {// IE8 and the following browser elements. attachEvent ('on' + type, handler);} else {// W3C standard browser
A little understanding, specific use can be re-read data. In order to eliminate differences between browsers. Do not use the customer detection method at a specific time, should give priority to the general method, and then consider the browser
I have roughly translated some
Article , Which may be incorrect. please correct me. It is worth noting that the comments are also worth reading.
Feature Detection At first, front-end engineers opposed browser detection. They thought the
The most classic use of this is the Universal addevent function:
function addEvent(element, type, handler) {
if (element.attachEvent) { //IE8及以下浏览器
element.attachEvent('on' + type, handler);
}
else { //W3C标准浏览器
element.addEventListener(type,
First, the original (basic data: String, number, Boolean, null, undefined) types are detected.Detect the original type with typeof: 1. For strings, typeof returns "string";2. For numbers, typeof returns "number";3. For Boolean type, typeof returns
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.